/**
* Return a themed form element.
*
* @param element
* An associative array containing the properties of the element.
* Properties used: title, description, id, required
* @param $value
* The form element's data.
* @return
* A string representing the form element.
*
* @ingroup themeable
*/
function phptemplate_form_element($element,$value) {
// This is also used in the installer, pre-database setup.
$t = get_t();
$output = '*' : '';
if (!empty($element['#title'])) {
$title = $element['#title'];
if (!empty($element['#id'])) {
$output .= ' \n";
}
else {
$output .= ' \n";
}
}
$output .= " $value\n";
if (!empty($element['#description'])) {
$output .= '
'. $element['#description'] ."
\n";
}
$output .= "\n";
return $output;
}
/**
* Format a set of radio buttons.
*
* @param $element
* An associative array containing the properties of the element.
* Properties used: title, value, options, description, required and attributes.
* @return
* A themed HTML string representing the radio button set.
*
* @ingroup themeable
*/
function phptemplate_radios($element) {
$class = 'form-radios';
if (isset($element['#attributes']['class'])) {
$class .= ' '. $element['#attributes']['class'];
}
$element['#children'] = ''. (!empty($element['#children']) ? $element['#children'] : '') .'';
if ($element['#title'] || $element['#description']) {
unset($element['#id']);
return theme('form_element', $element, $element['#children']);
}
else {
return $element['#children'];
}
}